﻿@model CSEPT.Models.EventViewModel
@{
    ViewBag.Title = "Home";
}
 <div class="row">
    <div class="col-xs-12">
        <h2 class="pull-left">Crowd Sourced Event Photo Tracking</h2>
        @if (Model.isLoggedIn) { 
            <div class="pull-right">
                <br />
                <a class="btn btn-md btn-success" href="@Url.Action("Create", "Event")">Add Event</a>
            </div>
        }
    </div>
</div>

<div class="row">
@foreach (CSEPT.Event e in Model.Events)
{
    <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 event">
        <div class="event">
            <div class="event-links">

                @if (Model.isLoggedIn) { 
                    <a href="@Url.Action("Add", "Photo", new {@EventID = e.ID})" class="btn btn-default upload pull-right" data-toggle="tooltip" title="Upload Photos"><span class="glyphicon glyphicon-upload"></span></a>
                    <a href="@Url.Action("Register", "Register", new {@EventID = e.ID})" class="btn btn-default register pull-right" data-toggle="tooltip" title="Register/Modify Registration"><span class="glyphicon glyphicon-list-alt"></span></a>
                    if (e.Owner.ID == Model.CurrUser.ID)
                    {
                        <a href="@Url.Action("Modify", "Event", new {@EventID = e.ID })" data-toggle="tooltip" class="btn pull-right btn-default edit" title="Modify Event"><span class="glyphicon glyphicon-edit"></span></a>
                    }
                }
            </div>
            <div class="event-bg">
                @if (e.Thumbnail.ID != 0) { 
                    <img class="img-responsive" src="@Url.Content("~/EventPhotos/" + @e.Thumbnail.ID + "_thumbnail.jpg")" />
                }
                else
                {
                    
                }
                <div class="bigfill"></div>
            </div>
            <div class="event-info">
                <h4><a href="@Url.Action("Event", "Photo", new {@EventID = e.ID})">@e.Title</a> &nbsp;<small><small>@e.StartDate.ToString("MM/dd/yyyy") - @e.EndDate.ToString("MM/dd/yyyy")</small></small></h4>
                <p>@e.Description</p>
            </div>
        </div>

    </div>
}
</div>

<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip();
    });
</script>